package com.adingxiong.cft.service;

import com.adingxiong.cft.common.FileData;
import com.adingxiong.cft.entity.TUser;
import com.adingxiong.cft.entity.dto.LoginParam;
import com.adingxiong.cft.entity.dto.OnlineUser;
import com.adingxiong.cft.entity.dto.UpdatePasswordParam;
import com.adingxiong.cft.entity.dto.UserRegister;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.security.core.userdetails.UserDetails;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author xiongc
 * @since 2020-09-22
 */
public interface ITUserService extends IService<TUser> {

    String login(String username,String password);

    UserDetails loadByUserName(String username);

    TUser getUserByUsername(String username);

    void updateLoginTime(String username);

    /**
     * 刷新token的功能
     * @param oldToken 旧的token
     */
    String refreshToken(String oldToken);

    TUser register(UserRegister register);

    Page<TUser> list(String keywords,Integer pageSize,Integer pageNum);

    boolean update(Integer id ,TUser user);

    int updatePassword(UpdatePasswordParam param);

    void logOut(HttpServletRequest request);

    List<OnlineUser> getOnline();

    void exportAsWord(HttpServletResponse response,HttpServletRequest request) throws IOException;

    String getToken(String code);

    Map<String,Object> getUserInfo(String accessToken);
}
